using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_BillDETAILMap : EntityTypeConfiguration<SO_BillDETAIL>
    {
        public SO_BillDETAILMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Tansaction_id, t.ITEM, t.PRICE, t.QTY, t.cost, t.discount_precentage, t.Guarantor_1_percentage, t.Guarantor_2_percentage, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.BILL__)
                .HasMaxLength(8);

            this.Property(t => t.Tansaction_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.DESCRIPTION)
                .HasMaxLength(250);

            this.Property(t => t.LOCATION)
                .HasMaxLength(3);

            this.Property(t => t.Item_TYPE)
                .HasMaxLength(25);

            this.Property(t => t.Currency)
                .HasMaxLength(5);

            this.Property(t => t.Master_item)
                .HasMaxLength(10);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(303);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(48);

            // Table & Column Mappings
            this.ToTable("SO_BillDETAIL");
            this.Property(t => t.BILL__).HasColumnName("BILL_#");
            this.Property(t => t.Tansaction_id).HasColumnName("Tansaction_id");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DESCRIPTION).HasColumnName("DESCRIPTION");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.ENTRY_DATE).HasColumnName("ENTRY_DATE");
            this.Property(t => t.Item_TYPE).HasColumnName("Item_TYPE");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.PRICE).HasColumnName("PRICE");
            this.Property(t => t.QTY).HasColumnName("QTY");
            this.Property(t => t.cost).HasColumnName("cost");
            this.Property(t => t.EXTENDED_AMOUNT_Base_1).HasColumnName("EXTENDED_AMOUNT_Base_1");
            this.Property(t => t.EXTENDED_AMOUNT_Base_2).HasColumnName("EXTENDED_AMOUNT_Base_2");
            this.Property(t => t.EXTENDED_COST_Base_1).HasColumnName("EXTENDED_COST_Base_1");
            this.Property(t => t.EXTENDED_COST_Base_2).HasColumnName("EXTENDED_COST_Base_2");
            this.Property(t => t.PATIENT_AMOUNT_Base_1).HasColumnName("PATIENT_AMOUNT_Base_1");
            this.Property(t => t.PATIENT_AMOUNT_Base_2).HasColumnName("PATIENT_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_1).HasColumnName("GUARANTOR_1_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_2).HasColumnName("GUARANTOR_1_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_1).HasColumnName("GUARANTOR_2_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_2).HasColumnName("GUARANTOR_2_AMOUNT_Base_2");
            this.Property(t => t.discount_precentage).HasColumnName("discount_precentage");
            this.Property(t => t.Discount_amount_Base_1).HasColumnName("Discount_amount_Base_1");
            this.Property(t => t.Discount_amount_Base_2).HasColumnName("Discount_amount_Base_2");
            this.Property(t => t.Operation_serial).HasColumnName("Operation_serial");
            this.Property(t => t.Expiry).HasColumnName("Expiry");
            this.Property(t => t.Guarantor_1_percentage).HasColumnName("Guarantor_1_percentage");
            this.Property(t => t.Guarantor_2_percentage).HasColumnName("Guarantor_2_percentage");
            this.Property(t => t.Master_item).HasColumnName("Master_item");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
